import { generateHighlightNodeForSalePrice } from '@/utils/bizUtils';
import { getElInputNumer } from '@/constants/markupRate';

export const MAX_EDIT_LIMITS = 100 // 最大可编辑数量

const BASIC_TABLE_COLUMNS = [
  {
    title: '品类树',
    key: 'categoryPath'
  },
  {
    title: '四级类名称',
    key: 'categoryName',
  },
  {
    title: '四级类编码',
    key: 'categoryNo',
  },
  {
    title: '品牌ID',
    key: 'brandUuid'
  },
  {
    title: '品牌名称',
    key: 'brandName'
  },
  {
    title: '系列',
    key: 'seriesName'
  },
  {
    title: '是否核心商品',
    key: 'isCoreProductStr'
  },
]

export const EDIT_TABLE_COLUMNS = [
  ...BASIC_TABLE_COLUMNS,
  {
    title: '集团指导加价率',
    key: 'groupGuideAddRate',
  },
  {
    title: '区域标准加价率',
    children: [
      { title: '原值', key: 'oldGuideAddRate' },
      {
        title: '现值',
        render: (h, { row }) => getElInputNumer(h, row, 'guideAddRate')
      }
    ]
  },
  {
    title: '集团畅销指导加价率',
    key: 'groupSellWellAddRate',
  },
  {
    title: '区域畅销标准加价率',
    children: [
      { title: '原值', key: 'oldSellWellAddRate' },
      {
        title: '现值',
        render: (h, { row }) => getElInputNumer(h, row, 'sellWellAddRate')
      }
    ]
  },
  {
    title: '集团成交最低加价率',
    key: 'groupLimitAddRate',
  },
  {
    title: '区域成交最低加价率',
    children: [
      { title: '原值', key: 'oldLimitAddRate' },
      {
        title: '现值',
        render: (h, { row }) => getElInputNumer(h, row, 'limitAddRate')
      }
    ]
  },
]

export const VIEW_TABLE_COLUMNS = [
  ...BASIC_TABLE_COLUMNS,
  {
    title: '集团指导加价率',
    key: 'groupGuideAddRate',
  },
  {
    title: '区域标准加价率',
    children: [
      { title: '原值', key: 'oldGuideAddRate' },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNodeForSalePrice(h, row.oldGuideAddRate, row.guideAddRate)
      }
    ]
  },
  {
    title: '集团畅销指导加价率',
    key: 'groupSellWellAddRate',
  },
  {
    title: '区域畅销标准加价率',
    children: [
      { title: '原值', key: 'oldSellWellAddRate' },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNodeForSalePrice(h, row.oldSellWellAddRate, row.sellWellAddRate)
      }
    ]
  },
  {
    title: '集团成交最低加价率',
    key: 'groupLimitAddRate',
  },
  {
    title: '区域成交最低加价率',
    children: [
      { title: '原值', key: 'oldLimitAddRate' },
      {
        title: '现值',
        render: (h, { row }) => generateHighlightNodeForSalePrice(h, row.oldLimitAddRate, row.limitAddRate)
      }
    ]
  },
]
